<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>五指山污水处理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/logincss/layout.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/dtree/dtree.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/dtree/font/dtreefont.css" media="all">
</head>
<style>
    /* 底部固定区域 */
    .layui-layout-admin .layui-footer {
        padding: 10px 0;
        text-align: center;
    }

    .layui-layout-admin .layui-footer {
        background-color: #fff;
    }

    .el-input__suffix {
        position: absolute;
        height: 100%;
        right: 5px;
        top: 0;
        text-align: center;
        color: #c0c4cc;
        transition: all .3s;
        pointer-events: none;
    }
    .treeSelect .layui-select-title span {
        line-height: 38px;
    }
    .layui-form-select dl{
        padding: 0;
    }

</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" lay-filter="component-form-element" id="form" method="post" >
                <div class="layui-tab layui-tab-brief">
                    <div class="layui-tab-content" style="height: auto">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs11">
                                        <label class="layui-form-label">村庄名称</label>
                                        <div class="layui-input-block">
                                            <input id="cun" class="layui-input" name="cun" type="text" autoComplete="off"  >
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div class="layui-form-mid layui-word-aux"
                                             style="color: red !important;padding: 10px !important;">*
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs11">
                                        <label class="layui-form-label">检查日期</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="createDateString" id="createDateString"
                                                   autocomplete="off"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质酸碱度(pH)</label>
                                        <div class="layui-input-block">
                                           <input name="cph" id="cph"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                       <span id="cphbz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="cphg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="cpbhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质化学需氧量(COD<sub>cr</sub>)</label>
                                        <div class="layui-input-block">
                                            <input name="chxxyl" id="chxxyl"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="chxxylbz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="chxxylhg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="chxxylbhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质氨氮(NH<sub>3</sub>-N)</label>
                                        <div class="layui-input-block">
                                            <input name="cad" id="cad"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="cadbz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="cadhg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="cadbhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质总氮(TN)</label>
                                        <div class="layui-input-block">
                                            <input name="czd" id="czd"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="czdbz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="czdhg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="czdbhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质总磷(TP)</label>
                                        <div class="layui-input-block">
                                            <input name="czl" id="czl"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="czlbz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="czlhg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="czlbhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质悬浮物(SS)</label>
                                        <div class="layui-input-block">
                                            <input name="cxfw" id="cxfw"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="cxfwbz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="cxfwhg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="cxfwbhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质粪大肠菌群数</label>
                                        <div class="layui-input-block">
                                            <input name="cfdcjqs" id="cfdcjqs"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="cfdcjqsbz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="cfdcjqshg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="cfdcjqsbhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">出水水质动植物油</label>
                                        <div class="layui-input-block">
                                            <input name="cdzwy" id="cdzwy"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="cdzwybz" style="padding: 10px !important;"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="cdzwyhg" style="color: green !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">合格
                                        </div>
                                        <div hidden id="cdzwybhg" style="color: red !important;padding: 10px !important;    width: 100px;
    margin-top: -10px;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质酸碱度(PH)</label>
                                        <div class="layui-input-block">
                                            <input name="jph" id="jph"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jphbz" ></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jphhg" style="color: green !important;padding: 10px !important;">合格
                                        </div>
                                        <div hidden id="jphbhg" style="color: red !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质化学需氧量(COD<sub>cr</sub>)</label>
                                        <div class="layui-input-block">
                                            <input name="jhxxyl" id="jhxxyl"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jhxxylbz"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jhxxylhg" style="color: green !important;padding: 10px !important;">合格
                                        </div>
                                        <div hidden id="jhxxylbhg" style="color: red !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质氨氮(NH<sub>3</sub>-N)</label>
                                        <div class="layui-input-block">
                                            <input name="jad" id="jad"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jadbz"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jadhg" style="color: green !important;padding: 10px !important;">合格
                                        </div>
                                        <div hidden id="jadbhg" style="color: red !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质总氮(TN)</label>
                                        <div class="layui-input-block">
                                            <input name="jzd" id="jzd"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jzdbz"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jzdhg" style="color: green !important;padding: 10px !important;">合格
                                        </div>
                                        <div hidden id="jzdbhg" style="color: red !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质总磷(TP)</label>
                                        <div class="layui-input-block">
                                            <input name="jzl" id="jzl"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jzlbz"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jzlhg" style="color: green !important;padding: 10px !important;">合格
                                        </div>
                                        <div hidden id="jzlbhg" style="color: red !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质悬浮物(SS)</label>
                                        <div class="layui-input-block">
                                            <input name="jxfw" id="jxfw"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jxfwbz"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jxfwhg" style="color: red !important;padding: 10px !important;">合格
                                        </div>
                                        <div hidden id="jxfwbhg" style="color: green !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质粪大肠菌群数</label>
                                        <div class="layui-input-block">
                                            <input name="jfdcjqs" id="jfdcjqs"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jfdcjqsbz"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jfdcjqshg" style="color: red !important;padding: 10px !important;">不合格
                                        </div>
                                        <div hidden id="jfdcjqsbhg" style="color: green !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs10">
                                        <label class="layui-form-label">进水水质动植物油</label>
                                        <div class="layui-input-block">
                                            <input name="jdzwy" id="jdzwy"  class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <span id="jdzwybz"></span>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div hidden id="jdzwyhg" style="color: red !important;padding: 10px !important;">不合格
                                        </div>
                                        <div hidden id="jdzwybhg" style="color: green !important;padding: 10px !important;">不合格
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-footer" style="left: 0;padding: 0px;">
                        <button class="layui-btn" lay-submit lay-filter="*" id="pushButton">立即提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="<%=request.getContextPath()%>/huazhi/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script>
    var hxxyy = 0
    var dzwy = 0
    var andan = 0
    var zongdan = 0
    var xfklw = 0
    var zl = 0
    var pdcgj = 0
    var ph = 0

    layui.use(['form', 'laydate', 'layer','laypage','dtree'], function () {
        var $ = layui.$
            , form = layui.form
            , laydate = layui.laydate
            , layer = layui.layer
            , dtree = layui.dtree

        //路径
        var curWwwPath = window.document.location.href;
        var pathName = window.document.location.pathname;
        var pos = curWwwPath.indexOf(pathName);
        var localhostPath = curWwwPath.substring(0, pos);
        var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);


        laydate.render({
            elem: '#createDateString' //指定元素
        });

        var inputCun = document.getElementById("cun");

        //获得焦点
        inputCun.onfocus=function (){

                layer.open({
                    title: "自然村选择",
                    type: 2,
                    content: localhostPath + projectName + '/rest/getRoute?type=instrument&url=treeSel',
                    //是否显示右上角关闭图标，默认为1，显示
                    area: ['90%', '91%'],
                    maxmin: true,
                    shade: 0.6,
                    anim: 4,
                    skin: 'layui-layer-molv',
                    resize: true,
                    success: function (layero, index) {  //当你需要在层创建完毕时即执行一些语句，可以通过该回调 想相当于吧值转到子界面
                        var iframe = window['layui-layer-iframe' + index];
                    }
                });
            }


        <%--$.ajax({--%>
        <%--    type: "get",--%>
        <%--    url: "<%=request.getContextPath()%>/rest/base/seleAllZrc",--%>
        <%--    dataType: "json",--%>
        <%--    async: false,--%>
        <%--    success:function (msg){--%>
        <%--        var content = '<option value="">请选择</option>';--%>
        <%--        var  xzSelect = $("#cun");--%>
        <%--        for (var i = 0;i<msg.zrcList.length;i++){--%>
        <%--            content+='<option value="' + msg.zrcList[i].title + '">' + msg.zrcList[i].title + '</option>';;--%>
        <%--        }--%>
        <%--        xzSelect.append(content)--%>
        <%--        form.render();--%>
        <%--    }--%>
        <%--})--%>

        <%--form.on('select(cun-filter)',function (data){--%>
        <%--    $.ajax({--%>
        <%--        type: "post",--%>
        <%--        url: "<%=request.getContextPath()%>/rest/base/getLineByCunzi",--%>
        <%--        dataType: "json",--%>
        <%--        async: false,--%>
        <%--        data:{--%>
        <%--            'cun':data.value,--%>
        <%--        },--%>
        <%--        success: function (msg) {--%>
        <%--            if(msg.csbz == "一级" ){--%>
        <%--                hxxyy =60--%>
        <%--                dzwy = 3--%>
        <%--                andan = 8--%>
        <%--                zongdan = 20--%>
        <%--                xfklw = 20--%>
        <%--                zl= 1--%>
        <%--                pdcgj =10--%>

        <%--            }else if (msg.csbz == "二级"){--%>
        <%--                hxxyy =80--%>
        <%--                dzwy = 5--%>
        <%--                andan = 20--%>
        <%--                zongdan = 10000--%>
        <%--                xfklw = 30--%>
        <%--                zl= 3--%>
        <%--                pdcgj =10000--%>

        <%--            }else {--%>
        <%--                hxxyy =120--%>
        <%--                dzwy = 20--%>
        <%--                andan = 25--%>
        <%--                zongdan = 10000--%>
        <%--                xfklw = 60--%>
        <%--                zl= 10000--%>
        <%--                pdcgj =10000--%>
        <%--            }--%>
        <%--            document.getElementById("cadbz").innerText = andan--%>
        <%--            document.getElementById("cphbz").innerText = '6-9'--%>
        <%--            document.getElementById("chxxylbz").innerText = hxxyy--%>
        <%--            document.getElementById("czdbz").innerText = zongdan--%>
        <%--            document.getElementById("czlbz").innerText = zl--%>
        <%--            document.getElementById("cxfwbz").innerText = xfklw--%>
        <%--            document.getElementById("cfdcjqsbz").innerText = pdcgj--%>
        <%--            document.getElementById("cdzwybz").innerText = dzwy--%>
        <%--        }--%>
        <%--    })--%>
        <%--})--%>

        $.ajax("/BindCombox/GetDeptData", false, "POST", {}, function (data) {
            var jsondata = JSON.parse(data);
            if (jsondata.IsError) {
                layer.msg("" + jsondata.ErrMsg, { icon: 5 });
            } else {
                zNodes = jsondata.Data;//获取数据源
                initSelectTree("PDEPT_KEY", true, { "Y": "ps", "N": "s" }, zNodes);
                var treeObj = $.fn.zTree.getZTreeObj("PDEPT_KEYTree");
                var node = treeObj.getNodes();
                treeObj.selectNode(node[0]);
                treeObj.checkNode(node[0], true, true, true);
            }
        });



        $("#cph").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("cphg").style.display = "none";
                document.getElementById("cpbhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)

          if(inputValue<6 || inputValue>9){
              document.getElementById("cphg").style.display = "none";
              document.getElementById("cpbhg").style.display = "block";
          }else {
              document.getElementById("cpbhg").style.display = "none";
              document.getElementById("cphg").style.display = "block";
          }
        })


        $("#chxxyl").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("chxxylhg").style.display = "none";
                document.getElementById("chxxylbhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)

            if(inputValue > hxxyy){
                document.getElementById("chxxylhg").style.display = "none";
                document.getElementById("chxxylbhg").style.display = "block";
            }else {
                document.getElementById("chxxylbhg").style.display = "none";
                document.getElementById("chxxylhg").style.display = "block";
            }
        })


        $("#cad").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("cadhg").style.display = "none";
                document.getElementById("cadbhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)

            if(inputValue > andan){
                document.getElementById("cadhg").style.display = "none";
                document.getElementById("cadbhg").style.display = "block";
            }else {
                document.getElementById("cadbhg").style.display = "none";
                document.getElementById("cadhg").style.display = "block";
            }
        })

        $("#czd").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("czdhg").style.display = "none";
                document.getElementById("czdbhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)

            if(inputValue > zongdan){
                document.getElementById("czdhg").style.display = "none";
                document.getElementById("czdbhg").style.display = "block";
            }else {
                document.getElementById("czdbhg").style.display = "none";
                document.getElementById("czdhg").style.display = "block";
            }
        })

        $("#czl").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("czlhg").style.display = "none";
                document.getElementById("czlbhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)

            if(inputValue > zl){
                document.getElementById("czlhg").style.display = "none";
                document.getElementById("czlbhg").style.display = "block";
            }else {
                document.getElementById("czlbhg").style.display = "none";
                document.getElementById("czlhg").style.display = "block";
            }
        })

        $("#cxfw").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("cxfwhg").style.display = "none";
                document.getElementById("cxfwbhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)

            if(inputValue > xfklw){
                document.getElementById("cxfwhg").style.display = "none";
                document.getElementById("cxfwbhg").style.display = "block";
            }else {
                document.getElementById("cxfwbhg").style.display = "none";
                document.getElementById("cxfwhg").style.display = "block";
            }
        })

        $("#cfdcjqs").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("cfdcjqshg").style.display = "none";
                document.getElementById("cfdcjqsbhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)

            if(inputValue > pdcgj){
                document.getElementById("cfdcjqshg").style.display = "none";
                document.getElementById("cfdcjqsbhg").style.display = "block";
            }else {
                document.getElementById("cfdcjqsbhg").style.display = "none";
                document.getElementById("cfdcjqshg").style.display = "block";
            }
        })

        $("#cdzwy").bind("input propertychang",function(event) {
            if (this.value == ""){
                document.getElementById("cdzwyhg").style.display = "none";
                document.getElementById("cdzwybhg").style.display = "none";
                return true
            }
            var inputValue = parseInt(this.value);
            console.log(inputValue)
            if(inputValue > dzwy){
                document.getElementById("cdzwyhg").style.display = "none";
                document.getElementById("cdzwybhg").style.display = "block";
            }else {
                document.getElementById("cdzwybhg").style.display = "none";
                document.getElementById("cdzwyhg").style.display = "block";
            }
        })

        //自定义验证规则
        form.verify({

        });



        //第一种方法添加用户
        form.on('submit(*)', function (data) {
            var field = data.field//当前容器的全部表单字段，名值对形式：{name: value}
            var name=field.name;
            var flag=true;
            $.ajax({
                type: "post",
                url: "<%=request.getContextPath()%>/rest/base/getBaseExist",
                dataType: "json",
                async: false,
                data: "name=" + name + "&field=village",
                success: function (msg) {
                    flag = msg;
                }
            })
            if(!flag){
                return  false;
            }
            var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.6});
            $("#pushButton").addClass("layui-btn layui-btn-disabled").prop("disabled", true);
            $.ajax({
                type: "post",
                url: "<%=request.getContextPath()%>/rest/base/addSzjc",
                data: field,
                dataType: "json",
                async:false,
                success: function (obj) {
                    setTimeout(function () {
                        layer.close(index);
                        if (obj === true) {
                            layer.msg('添加成功');
                        } else {
                            layer.msg(obj.errorMsg);
                        }
                    }, 2000);
                    setTimeout(function () {
                        var indexs = parent.layer.getFrameIndex(window.name);//获取当前弹出层的层级
                        parent.layer.close(indexs);//关闭弹出层
//                        window.parent.location.reload();//刷新父页面
                    }, 4000);
                }
            })
            return false;
        });


    });

    function initSelectTree(id, isMultiple, chkboxType, zNodes) {
        var setting = {

            data: {
                simpleData: {
                    enable: true
                }
            },
            check: {
                enable: false,
                chkStyle: "radio",
                radioType: "all",

            },
            chkboxType: { "Y": "ps", "N": "ps" },
            callback: {
                onClick: onClick,
                onCheck: onCheck
            }

        };
        if (isMultiple) {
            setting.check.enable = isMultiple;
        }
        if (chkboxType !== undefined && chkboxType != null) {
            setting.check.chkboxType = chkboxType;
        }
        var html = '<div class = "layui-select-title" >' +
            '<input id="' + id + 'Show"' + 'type = "text" placeholder = "请选择" value = "" class = "layui-input" readonly>' +
            '<i class= "layui-edge" ></i>' +
            '</div>';
        $("#" + id).append(html);

        $("#" + id).append('<dl  class="layui-anim layui-anim-upbit" ><div class="tree-content scrollbar">' +
            '<input hidden id="' + id + 'Hide" ' +
            'name="' + $(".select-tree").attr("id") + '">' +
            '<ul id="' + id + 'Tree" class="ztree scrollbar" style="margin-top:0;"></ul>' +
            '</div></dl>');
        $("#" + id).bind("click", function () {
            if ($(this).parent().find(".tree-content").css("display") !== "none") {
                hideMenu()
            } else {
                $(this).addClass("layui-form-selected");
                var Offset = $(this).offset();
                var width = $(this).width() - 2 - 15;
                $(this).parent().find(".tree-content").css({
                    left: Offset.left + "px",
                    top: Offset.top + $(this).height() + "px",
                    height: 250 + "px",
                }).slideDown("fast");
                $(this).parent().find(".tree-content").css({
                    width: width,

                });
                $("body").bind("mousedown", onBodyDown);
            }
        });
        $.fn.zTree.init($("#" + id + "Tree"), setting, zNodes);
        hideMenu();
    }

    function onClick(event, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj(treeId);
        if (zTree.setting.check.enable == true) {
            zTree.checkNode(treeNode, !treeNode.checked, false)
            assignment(treeId, zTree.getCheckedNodes());
        } else {
            assignment(treeId, zTree.getSelectedNodes());
            hideMenu();
        }
    }

    function onCheck(event, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj(treeId);
        assignment(treeId, zTree.getCheckedNodes());
    }

    function hideMenu() {
        $(".select-tree").removeClass("layui-form-selected");
        $(".tree-content").fadeOut("fast");
        $("body").unbind("mousedown", onBodyDown);
    }

    function assignment(treeId, nodes) {
        var names = "";
        var ids = "";
        for (var i = 0, l = nodes.length; i < l; i++) {
            names += nodes[i].name + ",";
            ids += nodes[i].id + ",";
        }
        if (names.length > 0) {
            names = names.substring(0, names.length - 1);
            ids = ids.substring(0, ids.length - 1);
        }
        treeId = treeId.substring(0, treeId.length - 4);
        $("#" + treeId + "Show").attr("value", names);
        $("#" + treeId + "Show").attr("title", names);
        $("#" + treeId + "Hide").attr("value", ids);
    }

    function onBodyDown(event) {
        if ($(event.target).parents(".tree-content").html() == null) {
            hideMenu();
        }
    }

    function getCheckCun(cunname){
        document.getElementById("cun").value = cunname
        getSzData(cunname)
    }
    function getSzData(data){
        $.ajax({
            type: "post",
            url: "<%=request.getContextPath()%>/rest/base/getLineByCunziForSzjc",
            dataType: "json",
            async: true,
            data:{
                'cun':data,
            },
            success: function (msg) {
                if(msg.csbz == "一级" ){
                    hxxyy =60
                    dzwy = 3
                    andan = 8
                    zongdan = 20
                    xfklw = 20
                    zl= 1
                    pdcgj =10

                }else if (msg.csbz == "二级"){
                   hxxyy =80
                    dzwy = 5
                    andan = 20
                    zongdan = 10000
                    xfklw = 30
                    zl= 3
                    pdcgj =10000

                }else {
                    hxxyy =120
                    dzwy = 20
                    andan = 25
                    zongdan = 10000
                    xfklw = 60
                    zl= 10000
                    pdcgj =10000
                }
                document.getElementById("cadbz").innerText = andan
                document.getElementById("cphbz").innerText = '6-9'
                document.getElementById("chxxylbz").innerText = hxxyy
                if(zongdan == 10000){
                    document.getElementById("czdbz").innerText = ""
                }else {
                    document.getElementById("czdbz").innerText = zongdan
                }

                document.getElementById("czlbz").innerText = zl
                if(xfklw == 10000){
                    document.getElementById("cxfwbz").innerText = ""
                }else {
                    document.getElementById("cxfwbz").innerText = xfklw
                }
                if(pdcgj == 10000){
                    document.getElementById("cfdcjqsbz").innerText = ""
                }else {
                    document.getElementById("cfdcjqsbz").innerText = pdcgj
                }

                document.getElementById("cdzwybz").innerText = dzwy
            }
        })
    }


<%--    function getCheckCun(cunname){--%>
<%--        document.getElementById("cun").value = cunname--%>
<%--            $.ajax({--%>
<%--                type: "post",--%>
<%--                url: "<%=request.getContextPath()%>/rest/base/getLineByCunzi",--%>
<%--                dataType: "json",--%>
<%--                async: false,--%>
<%--                data:{--%>
<%--                    'cun':cunname,--%>
<%--                },--%>
<%--                success: function (msg) {--%>
<%--                    if(msg.csbz == "一级" ){--%>
<%--                        hxxyy =60--%>
<%--                        dzwy = 3--%>
<%--                        andan = 8--%>
<%--                        zongdan = 20--%>
<%--                        xfklw = 20--%>
<%--                        zl= 1--%>
<%--                        pdcgj =10--%>
<%--                    }else if (msg.csbz == "二级"){--%>
<%--                        hxxyy =80--%>
<%--                        dzwy = 5--%>
<%--                        andan = 20--%>
<%--                        zongdan = 10000--%>
<%--                        xfklw = 30--%>
<%--                        zl= 3--%>
<%--                        pdcgj =10000--%>

<%--                    }else {--%>
<%--                        hxxyy =120--%>
<%--                        dzwy = 20--%>
<%--                        andan = 25--%>
<%--                        zongdan = 10000--%>
<%--                        xfklw = 60--%>
<%--                        zl= 10000--%>
<%--                        pdcgj =10000--%>
<%--                    }--%>
<%--                    document.getElementById("cadbz").innerText = andan--%>
<%--                    document.getElementById("cphbz").innerText = '6-9'--%>
<%--                    document.getElementById("chxxylbz").innerText = hxxyy--%>
<%--                    document.getElementById("czdbz").innerText = zongdan--%>
<%--                    document.getElementById("czlbz").innerText = zl--%>
<%--                    document.getElementById("cxfwbz").innerText = xfklw--%>
<%--                    document.getElementById("cfdcjqsbz").innerText = pdcgj--%>
<%--                    document.getElementById("cdzwybz").innerText = dzwy--%>
<%--                }--%>
<%--            })--%>

<%--    }--%>


</script>
</body>
</html>